package com.lingmeng.system.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lingmeng.common.core.annotation.Excel;
import com.lingmeng.common.core.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 设备对象 equipment
 * 
 * @author lingmeng
 * @date 2024-07-18
 */
@Getter
@Setter
@Accessors(chain = true)
public class Equipment extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** id */
    private Long id;

    /** 序列号 */
    @Excel(name = "序列号")
    private String serialNum;

    /** MAC地址 */
    @Excel(name = "MAC地址")
    private String mac;

    /** 绑定用户id */
    @Excel(name = "绑定用户id")
    private Long userId;

    /** 设备名称 */
    @Excel(name = "设备名称")
    private String name;

    /** 制造商 */
    @Excel(name = "制造商")
    private String manufacturer;

    /** 型号 */
    @Excel(name = "型号")
    private String model;

    /** 在线状态 */
    @Excel(name = "在线状态")
    private String online;

    /** 设备状态 */
    @Excel(name = "设备状态")
    private Integer status;

    /** 生产日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
    private LocalDate manufactureDate;

    /** 激活时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "激活时间", width = 30, dateFormat = "yyyy-MM-dd")
    private LocalDateTime activationTime;

    /** 总在线时长, 单位: s */
    @Excel(name = "总在线时长")
    private Long runtimeCount;

    /** 激活码 */
    @Excel(name = "激活码")
    private String activationCode;

    /** 损坏时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "损坏时间", width = 30, dateFormat = "yyyy-MM-dd")
    private LocalDateTime damageTime;


    public Equipment insertClean(){
        this.setId(null)
                .setUserId(null)
                .setSerialNum(null)
                .setOnline(null)
                .setStatus(null)
                .setActivationTime(null)
                .setRuntimeCount(null)
                .setActivationCode(null)
                .setDamageTime(null)
                .setCreateTime(null)
                .setUpdateTime(null)
                .setCreateBy(null)
                .setUpdateBy(null);
        return this;
    }
}
